-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: remove square size from block data #1051
feat!: remove square size from block data #1051
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, why are we removing the data hash from block data? Isn't this how we are passing the data root from the app back to core?
I guess that changed, and we're using this: celestia-core/state/execution.go Lines 139 to 151 in d02553f
Note: the PR is to main and not to current releases branch |
types/block.go
Outdated
data.SquareSize = dp.SquareSize | ||
data.hash = dp.Hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is what I was referring to @sweexordious
if we don't do this, then when we call data.Hash()
Lines 1025 to 1037 in d02553f
// Hash returns the hash of the data | |
func (data *Data) Hash() cmtbytes.HexBytes { | |
if data == nil { | |
return (Txs{}).Hash() | |
} | |
if data.hash == nil { | |
data.hash = data.Txs.Hash() // NOTE: leaves of merkle tree are TxIDs | |
} | |
// this is the expected behavior where `data.hash` was set by celestia-app | |
// in PrepareProposal | |
return data.hash | |
} |
we will not use the celestia-app version of the hash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is ignoring the hash we're passing back and instead we're using the standard tendermint one which is why the tests pass fine (that's actually the only reason we allow this to occur at all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it certainly doesn't have to be in this PR, but since this mechanism is so hidden it would probably be a good idea to include a test to ensure that we don't miss this in the future. Currently, those tests are only in the application, but we should be able to modify one of the test applications here to modify the data root
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 🙏
what do you think about this? f84fa8a
We could either do this, or move those two lines that set the data hash and square size to the DataFromProto
method. However, we will also need to change:
celestia-core/state/execution.go
Lines 154 to 156 in 842a0b5
block.Data, _ = types.DataFromProto(&cmtproto.Data{ | |
Txs: rpp.Txs[:len(rpp.Txs)-2], | |
}) |
to take the whole rpp.Txs
slice with the square size and the data hash appended at the end.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we call data.Hash() in other places, therefore we are unable to only set the value in the header
if we change one of the test applications to also modify the header, then we will be able to test this issue
Theoretically it is possible to remove the hash field from the data struct so long as the data root can be directly added to the header. |
Agreed. But I checked comet and apparently they still have that in the celestia-core/state/execution.go Line 180 in d02553f
|
e20e0f1
to
8859c76
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for fixing 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one last hardcoded test I think
TestBlockchainMessageVectors
Yup I'm on it |
Description
Closes #1045
PR checklist
.changelog
(we useunclog to manage our changelog)
docs/
orspec/
) and code comments